﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Text.RegularExpressions;
using MessagePack.Formatters;
using MessagePack.Internal;

namespace MessagePack.Resolvers
{
	// Token: 0x0200011B RID: 283
	public class DynamicUnionResolver : IFormatterResolver
	{
		// Token: 0x06000436 RID: 1078 RVA: 0x00011EB7 File Offset: 0x000102B7
		private DynamicUnionResolver()
		{
		}

		// Token: 0x06000437 RID: 1079 RVA: 0x00011EC0 File Offset: 0x000102C0
		static DynamicUnionResolver()
		{
			DynamicUnionResolver.assembly = new DynamicAssembly("MessagePack.Resolvers.DynamicUnionResolver");
		}

		// Token: 0x06000438 RID: 1080 RVA: 0x000121B5 File Offset: 0x000105B5
		public IMessagePackFormatter<T> GetFormatter<T>()
		{
			return DynamicUnionResolver.FormatterCache<T>.formatter;
		}

		// Token: 0x06000439 RID: 1081 RVA: 0x000121BC File Offset: 0x000105BC
		private static TypeInfo_wzh BuildType(Type type)
		{
			TypeInfo_wzh typeInfo = type.GetTypeInfo_wzh();
			UnionAttribute[] array = (from x in typeInfo.GetCustomAttributes<UnionAttribute>(true)
			orderby x.Key
			select x).ToArray<UnionAttribute>();
			if (array.Length == 0)
			{
				return null;
			}
			HashSet<int> hashSet = new HashSet<int>();
			HashSet<Type> hashSet2 = new HashSet<Type>();
			foreach (UnionAttribute unionAttribute in array)
			{
				if (!hashSet.Add(unionAttribute.Key))
				{
					throw new MessagePackDynamicUnionResolverException(string.Concat(new object[]
					{
						"Same union key has found. Type:",
						type.Name,
						" Key:",
						unionAttribute.Key
					}));
				}
				if (!hashSet2.Add(unionAttribute.SubType))
				{
					throw new MessagePackDynamicUnionResolverException(string.Concat(new object[]
					{
						"Same union subType has found. Type:",
						type.Name,
						" SubType: ",
						unionAttribute.SubType
					}));
				}
			}
			Type type2 = typeof(IMessagePackFormatter<>).MakeGenericType(new Type[]
			{
				type
			});
			TypeBuilder typeBuilder = DynamicUnionResolver.assembly.ModuleBuilder.DefineType("MessagePack.Formatters." + DynamicUnionResolver.SubtractFullNameRegex.Replace(type.FullName, string.Empty).Replace(".", "_") + "Formatter", TypeAttributes.Public | TypeAttributes.Sealed, null, new Type[]
			{
				type2
			});
			ConstructorBuilder constructorBuilder = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, Type.EmptyTypes);
			FieldBuilder typeToKeyAndJumpMap = typeBuilder.DefineField("typeToKeyAndJumpMap", typeof(Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>>), FieldAttributes.Private | FieldAttributes.InitOnly);
			FieldBuilder keyToJumpMap = typeBuilder.DefineField("keyToJumpMap", typeof(Dictionary<int, int>), FieldAttributes.Private | FieldAttributes.InitOnly);
			ILGenerator ilgenerator = constructorBuilder.GetILGenerator();
			DynamicUnionResolver.BuildConstructor(type, array, constructorBuilder, typeToKeyAndJumpMap, keyToJumpMap, ilgenerator);
			MethodBuilder methodBuilder = typeBuilder.DefineMethod("Serialize", MethodAttributes.FamANDAssem | MethodAttributes.Family | MethodAttributes.Final | MethodAttributes.Virtual, typeof(int), new Type[]
			{
				typeof(byte[]).MakeByRefType(),
				typeof(int),
				type,
				typeof(IFormatterResolver)
			});
			ILGenerator ilgenerator2 = methodBuilder.GetILGenerator();
			DynamicUnionResolver.BuildSerialize(type, array, methodBuilder, typeToKeyAndJumpMap, ilgenerator2);
			MethodBuilder methodBuilder2 = typeBuilder.DefineMethod("Deserialize", MethodAttributes.FamANDAssem | MethodAttributes.Family | MethodAttributes.Final | MethodAttributes.Virtual, type, new Type[]
			{
				typeof(byte[]),
				typeof(int),
				typeof(IFormatterResolver),
				typeof(int).MakeByRefType()
			});
			ILGenerator ilgenerator3 = methodBuilder2.GetILGenerator();
			DynamicUnionResolver.BuildDeserialize(type, array, methodBuilder2, keyToJumpMap, ilgenerator3);
			//return typeBuilder.CreateTypeInfo();
			return null;
		}

		// Token: 0x0600043A RID: 1082 RVA: 0x00012470 File Offset: 0x00010870
		private static void BuildConstructor(Type type, UnionAttribute[] infos, ConstructorInfo method, FieldBuilder typeToKeyAndJumpMap, FieldBuilder keyToJumpMap, ILGenerator il)
		{
			il.EmitLdarg(0);
			il.Emit(OpCodes.Call, DynamicUnionResolver.objectCtor);
			il.EmitLdarg(0);
			il.EmitLdc_I4(infos.Length);
			il.Emit(OpCodes.Ldsfld, DynamicUnionResolver.runtimeTypeHandleEqualityComparer);
			il.Emit(OpCodes.Newobj, DynamicUnionResolver.typeMapDictionaryConstructor);
			int num = 0;
			foreach (UnionAttribute unionAttribute in infos)
			{
				il.Emit(OpCodes.Dup);
				il.Emit(OpCodes.Ldtoken, unionAttribute.SubType);
				il.EmitLdc_I4(unionAttribute.Key);
				il.EmitLdc_I4(num);
				il.Emit(OpCodes.Newobj, DynamicUnionResolver.intIntKeyValuePairConstructor);
				il.EmitCall(DynamicUnionResolver.typeMapDictionaryAdd);
				num++;
			}
			il.Emit(OpCodes.Stfld, typeToKeyAndJumpMap);
			il.EmitLdarg(0);
			il.EmitLdc_I4(infos.Length);
			il.Emit(OpCodes.Newobj, DynamicUnionResolver.keyMapDictionaryConstructor);
			int num2 = 0;
			foreach (UnionAttribute unionAttribute2 in infos)
			{
				il.Emit(OpCodes.Dup);
				il.EmitLdc_I4(unionAttribute2.Key);
				il.EmitLdc_I4(num2);
				il.EmitCall(DynamicUnionResolver.keyMapDictionaryAdd);
				num2++;
			}
			il.Emit(OpCodes.Stfld, keyToJumpMap);
			il.Emit(OpCodes.Ret);
		}

		// Token: 0x0600043B RID: 1083 RVA: 0x000125E0 File Offset: 0x000109E0
		private static void BuildSerialize(Type type, UnionAttribute[] infos, MethodBuilder method, FieldBuilder typeToKeyAndJumpMap, ILGenerator il)
		{
			Label label = il.DefineLabel();
			Label label2 = il.DefineLabel();
			il.EmitLdarg(3);
			il.Emit(OpCodes.Brtrue_S, label);
			il.Emit(OpCodes.Br, label2);
			il.MarkLabel(label);
			LocalBuilder keyPair = il.DeclareLocal(typeof(KeyValuePair<int, int>));
			il.EmitLoadThis();
			il.EmitLdfld(typeToKeyAndJumpMap);
			il.EmitLdarg(3);
			il.EmitCall(DynamicUnionResolver.objectGetType);
			il.EmitCall(DynamicUnionResolver.getTypeHandle);
			il.EmitLdloca(keyPair);
			il.EmitCall(DynamicUnionResolver.typeMapDictionaryTryGetValue);
			il.Emit(OpCodes.Brfalse, label2);
			LocalBuilder local = il.DeclareLocal(typeof(int));
			il.EmitLdarg(2);
			il.EmitStloc(local);
			DynamicUnionResolver.EmitOffsetPlusEqual(il, null, delegate
			{
				il.EmitLdc_I4(2);
				il.EmitCall(DynamicUnionResolver.MessagePackBinaryTypeInfo.WriteFixedArrayHeaderUnsafe);
			});
			DynamicUnionResolver.EmitOffsetPlusEqual(il, null, delegate
			{
				il.EmitLdloca(keyPair);
				il.EmitCall(DynamicUnionResolver.intIntKeyValuePairGetKey);
				il.EmitCall(DynamicUnionResolver.MessagePackBinaryTypeInfo.WriteInt32);
			});
			Label label3 = il.DefineLabel();
			var array = (from x in infos
			select new
			{
				Label = il.DefineLabel(),
				Attr = x
			}).ToArray();
			il.EmitLdloca(keyPair);
			il.EmitCall(DynamicUnionResolver.intIntKeyValuePairGetValue);
			il.Emit(OpCodes.Switch, (from x in array
			select x.Label).ToArray<Label>());
			il.Emit(OpCodes.Br, label3);
			var array2 = array;
		
			il.MarkLabel(label3);
			il.EmitLdarg(2);
			il.EmitLdloc(local);
			il.Emit(OpCodes.Sub);
			il.Emit(OpCodes.Ret);
			il.MarkLabel(label2);
			il.EmitLdarg(1);
			il.EmitLdarg(2);
			il.EmitCall(DynamicUnionResolver.MessagePackBinaryTypeInfo.WriteNil);
			il.Emit(OpCodes.Ret);
		}

		// Token: 0x0600043C RID: 1084 RVA: 0x000128DC File Offset: 0x00010CDC
		private static void EmitOffsetPlusEqual(ILGenerator il, Action loadEmit, Action emit)
		{
			il.EmitLdarg(2);
			if (loadEmit != null)
			{
				loadEmit();
			}
			il.EmitLdarg(1);
			il.EmitLdarg(2);
			emit();
			il.Emit(OpCodes.Add);
			il.EmitStarg(2);
		}

		// Token: 0x0600043D RID: 1085 RVA: 0x00012918 File Offset: 0x00010D18
		private static void BuildDeserialize(Type type, UnionAttribute[] infos, MethodBuilder method, FieldBuilder keyToJumpMap, ILGenerator il)
		{
			Label label = il.DefineLabel();
			il.EmitLdarg(1);
			il.EmitLdarg(2);
			il.EmitCall(DynamicUnionResolver.MessagePackBinaryTypeInfo.IsNil);
			il.Emit(OpCodes.Brfalse_S, label);
			il.EmitLdarg(4);
			il.EmitLdc_I4(1);
			il.Emit(OpCodes.Stind_I4);
			il.Emit(OpCodes.Ldnull);
			il.Emit(OpCodes.Ret);
			il.MarkLabel(label);
			LocalBuilder local = il.DeclareLocal(typeof(int));
			il.EmitLdarg(2);
			il.EmitStloc(local);
			Label label2 = il.DefineLabel();
			il.EmitLdarg(1);
			il.EmitLdarg(2);
			il.EmitLdarg(4);
			il.EmitCall(DynamicUnionResolver.MessagePackBinaryTypeInfo.ReadArrayHeader);
			il.EmitLdc_I4(2);
			il.Emit(OpCodes.Beq_S, label2);
			il.Emit(OpCodes.Ldstr, "Invalid Union data was detected. Type:" + type.FullName);
			il.Emit(OpCodes.Newobj, DynamicUnionResolver.invalidOperationExceptionConstructor);
			il.Emit(OpCodes.Throw);
			il.MarkLabel(label2);
			DynamicUnionResolver.EmitOffsetPlusReadSize(il);
			LocalBuilder local2 = il.DeclareLocal(typeof(int));
			il.EmitLdarg(1);
			il.EmitLdarg(2);
			il.EmitLdarg(4);
			il.EmitCall(DynamicUnionResolver.MessagePackBinaryTypeInfo.ReadInt32);
			il.EmitStloc(local2);
			DynamicUnionResolver.EmitOffsetPlusReadSize(il);
			if (!DynamicUnionResolver.IsZeroStartSequential(infos))
			{
				Label label3 = il.DefineLabel();
				il.EmitLdarg(0);
				il.EmitLdfld(keyToJumpMap);
				il.EmitLdloc(local2);
				il.EmitLdloca(local2);
				il.EmitCall(DynamicUnionResolver.keyMapDictionaryTryGetValue);
				il.Emit(OpCodes.Brtrue_S, label3);
				il.EmitLdc_I4(-1);
				il.EmitStloc(local2);
				il.MarkLabel(label3);
			}
			LocalBuilder local3 = il.DeclareLocal(type);
			Label label4 = il.DefineLabel();
			il.Emit(OpCodes.Ldnull);
			il.EmitStloc(local3);
			il.Emit(OpCodes.Ldloc, local2);
			var array = (from x in infos
			select new
			{
				Label = il.DefineLabel(),
				Attr = x
			}).ToArray();
			il.Emit(OpCodes.Switch, (from x in array
			select x.Label).ToArray<Label>());
			il.EmitLdarg(2);
			il.EmitLdarg(1);
			il.EmitLdarg(2);
			il.EmitCall(DynamicUnionResolver.MessagePackBinaryTypeInfo.ReadNextBlock);
			il.Emit(OpCodes.Add);
			il.EmitStarg(2);
			il.Emit(OpCodes.Br, label4);
			var array2 = array;
			il.MarkLabel(label4);
			il.EmitLdarg(4);
			il.EmitLdarg(2);
			il.EmitLdloc(local);
			il.Emit(OpCodes.Sub);
			il.Emit(OpCodes.Stind_I4);
			il.Emit(OpCodes.Ldloc, local3);
			il.Emit(OpCodes.Ret);
		}

		// Token: 0x0600043E RID: 1086 RVA: 0x00012E3C File Offset: 0x0001123C
		private static bool IsZeroStartSequential(UnionAttribute[] infos)
		{
			for (int i = 0; i < infos.Length; i++)
			{
				if (infos[i].Key != i)
				{
					return false;
				}
			}
			return true;
		}

		// Token: 0x0600043F RID: 1087 RVA: 0x00012E6E File Offset: 0x0001126E
		private static void EmitOffsetPlusReadSize(ILGenerator il)
		{
			il.EmitLdarg(2);
			il.EmitLdarg(4);
			il.Emit(OpCodes.Ldind_I4);
			il.Emit(OpCodes.Add);
			il.EmitStarg(2);
		}

		// Token: 0x040001B9 RID: 441
		public static readonly DynamicUnionResolver Instance = new DynamicUnionResolver();

		// Token: 0x040001BA RID: 442
		private const string ModuleName = "MessagePack.Resolvers.DynamicUnionResolver";

		// Token: 0x040001BB RID: 443
		private static readonly DynamicAssembly assembly;

		// Token: 0x040001BC RID: 444
		private static readonly Regex SubtractFullNameRegex = new Regex(", Version=\\d+.\\d+.\\d+.\\d+, Culture=\\w+, PublicKeyToken=\\w+");

		// Token: 0x040001BD RID: 445
		private static readonly Type refByte = typeof(byte[]).MakeByRefType();

		// Token: 0x040001BE RID: 446
		private static readonly Type refInt = typeof(int).MakeByRefType();

		// Token: 0x040001BF RID: 447
		private static readonly Type refKvp = typeof(KeyValuePair<int, int>).MakeByRefType();

		// Token: 0x040001C0 RID: 448
		private static readonly MethodInfo getFormatterWithVerify = typeof(FormatterResolverExtensions).GetRuntimeMethods().First((MethodInfo x) => x.Name == "GetFormatterWithVerify");

		// Token: 0x040001C1 RID: 449
		private static readonly Func<Type, MethodInfo> getSerialize = (Type t) => typeof(IMessagePackFormatter<>).MakeGenericType(new Type[]
		{
			t
		}).GetRuntimeMethod("Serialize", new Type[]
		{
			DynamicUnionResolver.refByte,
			typeof(int),
			t,
			typeof(IFormatterResolver)
		});

		// Token: 0x040001C2 RID: 450
		private static readonly Func<Type, MethodInfo> getDeserialize = (Type t) => typeof(IMessagePackFormatter<>).MakeGenericType(new Type[]
		{
			t
		}).GetRuntimeMethod("Deserialize", new Type[]
		{
			typeof(byte[]),
			typeof(int),
			typeof(IFormatterResolver),
			DynamicUnionResolver.refInt
		});

		// Token: 0x040001C3 RID: 451
		private static readonly FieldInfo runtimeTypeHandleEqualityComparer = typeof(RuntimeTypeHandleEqualityComparer).GetField("Default");

		// Token: 0x040001C4 RID: 452
		private static readonly ConstructorInfo intIntKeyValuePairConstructor = typeof(KeyValuePair<int, int>).GetTypeInfo_wzh().DeclaredConstructors.First((ConstructorInfo x) => x.GetParameters().Length == 2);

		// Token: 0x040001C5 RID: 453
		private static readonly ConstructorInfo typeMapDictionaryConstructor = typeof(Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>>).GetTypeInfo_wzh().DeclaredConstructors.First(delegate(ConstructorInfo x)
		{
			ParameterInfo[] parameters = x.GetParameters();
			return parameters.Length == 2 && parameters[0].ParameterType == typeof(int);
		});

		// Token: 0x040001C6 RID: 454
		private static readonly MethodInfo typeMapDictionaryAdd = typeof(Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>>).GetRuntimeMethod("Add", new Type[]
		{
			typeof(RuntimeTypeHandle),
			typeof(KeyValuePair<int, int>)
		});

		// Token: 0x040001C7 RID: 455
		private static readonly MethodInfo typeMapDictionaryTryGetValue = typeof(Dictionary<RuntimeTypeHandle, KeyValuePair<int, int>>).GetRuntimeMethod("TryGetValue", new Type[]
		{
			typeof(RuntimeTypeHandle),
			DynamicUnionResolver.refKvp
		});

		// Token: 0x040001C8 RID: 456
		private static readonly ConstructorInfo keyMapDictionaryConstructor = typeof(Dictionary<int, int>).GetTypeInfo_wzh().DeclaredConstructors.First(delegate(ConstructorInfo x)
		{
			ParameterInfo[] parameters = x.GetParameters();
			return parameters.Length == 1 && parameters[0].ParameterType == typeof(int);
		});

		// Token: 0x040001C9 RID: 457
		private static readonly MethodInfo keyMapDictionaryAdd = typeof(Dictionary<int, int>).GetRuntimeMethod("Add", new Type[]
		{
			typeof(int),
			typeof(int)
		});

		// Token: 0x040001CA RID: 458
		private static readonly MethodInfo keyMapDictionaryTryGetValue = typeof(Dictionary<int, int>).GetRuntimeMethod("TryGetValue", new Type[]
		{
			typeof(int),
			DynamicUnionResolver.refInt
		});

		// Token: 0x040001CB RID: 459
		private static readonly MethodInfo objectGetType = typeof(object).GetRuntimeMethod("GetType", Type.EmptyTypes);

		// Token: 0x040001CC RID: 460
		private static readonly MethodInfo getTypeHandle = typeof(Type).GetProperty("TypeHandle").GetGetMethod();

		// Token: 0x040001CD RID: 461
		private static readonly MethodInfo intIntKeyValuePairGetKey = typeof(KeyValuePair<int, int>).GetProperty("Key").GetGetMethod();

		// Token: 0x040001CE RID: 462
		private static readonly MethodInfo intIntKeyValuePairGetValue = typeof(KeyValuePair<int, int>).GetProperty("Value").GetGetMethod();

		// Token: 0x040001CF RID: 463
		private static readonly ConstructorInfo invalidOperationExceptionConstructor = typeof(InvalidOperationException).GetTypeInfo_wzh().DeclaredConstructors.First(delegate(ConstructorInfo x)
		{
			ParameterInfo[] parameters = x.GetParameters();
			return parameters.Length == 1 && parameters[0].ParameterType == typeof(string);
		});

		// Token: 0x040001D0 RID: 464
		private static readonly ConstructorInfo objectCtor = typeof(object).GetTypeInfo_wzh().DeclaredConstructors.First((ConstructorInfo x) => x.GetParameters().Length == 0);

		// Token: 0x0200011C RID: 284
		private static class FormatterCache<T>
		{
			// Token: 0x0600044B RID: 1099 RVA: 0x00013044 File Offset: 0x00011444
			static FormatterCache()
			{
				TypeInfo_wzh typeInfo = typeof(T).GetTypeInfo_wzh();
				if (typeInfo.IsNullable())
				{
					typeInfo = typeInfo.GenericTypeArguments[0].GetTypeInfo_wzh();
					object formatterDynamic = DynamicUnionResolver.Instance.GetFormatterDynamic(typeInfo.AsType());
					if (formatterDynamic == null)
					{
						return;
					}
					DynamicUnionResolver.FormatterCache<T>.formatter = (IMessagePackFormatter<T>)Activator.CreateInstance(typeof(StaticNullableFormatter<>).MakeGenericType(new Type[]
					{
						typeInfo.AsType()
					}), new object[]
					{
						formatterDynamic
					});
					return;
				}
				else
				{
					TypeInfo_wzh typeInfo2 = DynamicUnionResolver.BuildType(typeof(T));
					if (typeInfo2 == null)
					{
						return;
					}
					DynamicUnionResolver.FormatterCache<T>.formatter = (IMessagePackFormatter<T>)Activator.CreateInstance(typeInfo2.AsType());
					return;
				}
			}

			// Token: 0x040001D4 RID: 468
			public static readonly IMessagePackFormatter<T> formatter;
		}

		// Token: 0x0200011D RID: 285
		private static class MessagePackBinaryTypeInfo
		{
			// Token: 0x040001D5 RID: 469
			public static TypeInfo_wzh TypeInfo = typeof(MessagePackBinary).GetTypeInfo_wzh();

			// Token: 0x040001D6 RID: 470
			public static MethodInfo WriteFixedMapHeaderUnsafe = typeof(MessagePackBinary).GetRuntimeMethod("WriteFixedMapHeaderUnsafe", new Type[]
			{
				DynamicUnionResolver.refByte,
				typeof(int),
				typeof(int)
			});

			// Token: 0x040001D7 RID: 471
			public static MethodInfo WriteFixedArrayHeaderUnsafe = typeof(MessagePackBinary).GetRuntimeMethod("WriteFixedArrayHeaderUnsafe", new Type[]
			{
				DynamicUnionResolver.refByte,
				typeof(int),
				typeof(int)
			});

			// Token: 0x040001D8 RID: 472
			public static MethodInfo WriteMapHeader = typeof(MessagePackBinary).GetRuntimeMethod("WriteMapHeader", new Type[]
			{
				DynamicUnionResolver.refByte,
				typeof(int),
				typeof(int)
			});

			// Token: 0x040001D9 RID: 473
			public static MethodInfo WriteArrayHeader = typeof(MessagePackBinary).GetRuntimeMethod("WriteArrayHeader", new Type[]
			{
				DynamicUnionResolver.refByte,
				typeof(int),
				typeof(int)
			});

			// Token: 0x040001DA RID: 474
			public static MethodInfo WritePositiveFixedIntUnsafe = typeof(MessagePackBinary).GetRuntimeMethod("WritePositiveFixedIntUnsafe", new Type[]
			{
				DynamicUnionResolver.refByte,
				typeof(int),
				typeof(int)
			});

			// Token: 0x040001DB RID: 475
			public static MethodInfo WriteInt32 = typeof(MessagePackBinary).GetRuntimeMethod("WriteInt32", new Type[]
			{
				DynamicUnionResolver.refByte,
				typeof(int),
				typeof(int)
			});

			// Token: 0x040001DC RID: 476
			public static MethodInfo WriteBytes = typeof(MessagePackBinary).GetRuntimeMethod("WriteBytes", new Type[]
			{
				DynamicUnionResolver.refByte,
				typeof(int),
				typeof(byte[])
			});

			// Token: 0x040001DD RID: 477
			public static MethodInfo WriteNil = typeof(MessagePackBinary).GetRuntimeMethod("WriteNil", new Type[]
			{
				DynamicUnionResolver.refByte,
				typeof(int)
			});

			// Token: 0x040001DE RID: 478
			public static MethodInfo ReadBytes = typeof(MessagePackBinary).GetRuntimeMethod("ReadBytes", new Type[]
			{
				typeof(byte[]),
				typeof(int),
				DynamicUnionResolver.refInt
			});

			// Token: 0x040001DF RID: 479
			public static MethodInfo ReadInt32 = typeof(MessagePackBinary).GetRuntimeMethod("ReadInt32", new Type[]
			{
				typeof(byte[]),
				typeof(int),
				DynamicUnionResolver.refInt
			});

			// Token: 0x040001E0 RID: 480
			public static MethodInfo ReadString = typeof(MessagePackBinary).GetRuntimeMethod("ReadString", new Type[]
			{
				typeof(byte[]),
				typeof(int),
				DynamicUnionResolver.refInt
			});

			// Token: 0x040001E1 RID: 481
			public static MethodInfo IsNil = typeof(MessagePackBinary).GetRuntimeMethod("IsNil", new Type[]
			{
				typeof(byte[]),
				typeof(int)
			});

			// Token: 0x040001E2 RID: 482
			public static MethodInfo ReadNextBlock = typeof(MessagePackBinary).GetRuntimeMethod("ReadNextBlock", new Type[]
			{
				typeof(byte[]),
				typeof(int)
			});

			// Token: 0x040001E3 RID: 483
			public static MethodInfo WriteStringUnsafe = typeof(MessagePackBinary).GetRuntimeMethod("WriteStringUnsafe", new Type[]
			{
				DynamicUnionResolver.refByte,
				typeof(int),
				typeof(string),
				typeof(int)
			});

			// Token: 0x040001E4 RID: 484
			public static MethodInfo ReadArrayHeader = typeof(MessagePackBinary).GetRuntimeMethod("ReadArrayHeader", new Type[]
			{
				typeof(byte[]),
				typeof(int),
				DynamicUnionResolver.refInt
			});

			// Token: 0x040001E5 RID: 485
			public static MethodInfo ReadMapHeader = typeof(MessagePackBinary).GetRuntimeMethod("ReadMapHeader", new Type[]
			{
				typeof(byte[]),
				typeof(int),
				DynamicUnionResolver.refInt
			});
		}
	}
}
